package com.caszx.chargingpile.holder.user;

import android.view.View;
import android.widget.TextView;

import com.app.base.adapter.holder.BaseHolder;
import com.caszx.chargingpile.R;
import com.caszx.chargingpile.entity.EntityChargeRecord;

import java.text.SimpleDateFormat;
import java.util.Date;

import static com.caszx.chargingpile.R.*;

/**
 * 充值记录
 */
public class ChargeRecordHolder extends BaseHolder<EntityChargeRecord> {

    private TextView txt_price;
    private TextView txt_model;
    private TextView txt_time;

    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
    public ChargeRecordHolder(View view) {
        super(view);
    }

    @Override
    protected void initView() {
        txt_price = (TextView) mRootView.findViewById(id.txt_price);
        txt_model = (TextView) mRootView.findViewById(id.txt_model);
        txt_time = (TextView) mRootView.findViewById(id.txt_time);
    }

    @Override
    protected void refreshView() {
        txt_price.setText("充值"+mItem.rechargeMoney+"元");
        //1、现金 2、网银转账、3、支付宝 5、虚拟充值
          if("1".equals(mItem.operateModel)){
              txt_model.setText("现金");
          } else if("2".equals(mItem.operateModel)){
              txt_model.setText("网银转账");
          }else if("3".equals(mItem.operateModel)){
              txt_model.setText("支付宝");
          }else if("5".equals(mItem.operateModel)){
              txt_model.setText("虚拟充值");
          }

        txt_time.setText(  dateFormat.format(new Date(mItem.operateTime)));

    }
}
